﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoVanHocTapData.Interface;
using CoVanHocTapData.Entities;

namespace CoVanHocTapData.Concretes
{
    public class ThangDiemDanhGiaRepository:IThangDiemDanhGiaRepository
    {
        #region property
        DangKyPhuEntities entities;
        #endregion

        #region constructor
        public ThangDiemDanhGiaRepository()
        {
            entities = new DangKyPhuEntities();
        }
        #endregion

        public IQueryable<Entities.ThangDiemDanhGia> LayTatCa()
        {
            return from m in entities.ThangDiemDanhGias
                   select m;
        }

        public IQueryable<Entities.ThangDiemDanhGia> LayThangDiemDanhGia(string xepLoai)
        {
            return (from m in entities.ThangDiemDanhGias
                        where m.XepLoai.ToLower().Equals(xepLoai.ToLower())
                        select m);
        }

        #region IThangDiemDanhGiaRepository Members

        /// <summary>
        /// chua quan tam nam ap dung
        /// </summary>
        /// <param name="DTB"></param>
        /// <returns></returns>
        public IQueryable<ThangDiemDanhGia> LayThangDiemDanhGia(float DTB)
        {
            return from m in entities.ThangDiemDanhGias
                   where DTB >= m.TuGiaTri.Value && DTB < m.DenGiaTri.Value
                   select m;
        }



        #endregion


        public IQueryable<ThangDiemDanhGia> LayThangDiemDanhGia(int soTC)
        {
            return from m in entities.ThangDiemDanhGias
                   where soTC >= m.SoTCToiThieu.Value && soTC< m.SoTCToiDa.Value
                   select m;
        }
    }
}
